#include "MainWindow.hpp"

#include <QtCore/QDebug>
#include <QtCore/QLocale>
#include <QtCore/QTextCodec>
#include <QtCore/QTranslator>

#include <QtGui/QApplication>


int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QString locale = QLocale::system().name();
    int loc( locale.indexOf( "_" ) );
    if ( loc != -1 )
    {
        locale.replace( loc, 3, "" );
    }
    qDebug() << "Found locale" << locale;

    QTranslator translator;
    if ( translator.load( QString( "yagoliq_fr" )/* + locale*/ ) )
        qDebug() << "Translation loaded";
    else
        qDebug() << "Could not load the translation";
    a.installTranslator( &translator );

    QTextCodec::setCodecForTr( QTextCodec::codecForName( "utf8" ) );

    MainWindow w;
    w.show();
    
    return a.exec();
}
